﻿using Microsoft.Extensions.Caching.Memory;
using OAS.Application.System.Dtos;
using OAS.Application.WorkApp.Dtos;
using OAS.Application.WorkApp.Services;
using OAS.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace OAS.Application.WorkApp
{
    public class WorkController : IDynamicApiController
    {
        private readonly ISqlSugarClient db;
        private readonly IWorkService _workService;
        public WorkController(IWorkService workService, ISqlSugarClient db)
        {
            this.db = db;
            _workService = workService;
        }
        public async Task<List<Work>> GetAllWork()
        {
            return await _workService.GetAllWork();
        }
        public async Task<List<DtoWork>> GetWorkByStatus()
        {
            return await _workService.GetWorkByStatus();
        }
        [HttpPost]
        public async Task<object> GetWorkList(DtoQuery dto)
        {
            return await _workService.GetWorkList(dto);
        }
        public async Task AddWork(Work work)
        {
            await _workService.AddWork(work);
        }
        public async Task<Work> UpdateWork(Work work)
        {
            return await _workService.UpdateWork(work);
        }
        public async Task DeleteWork([FromBody] string[] ids)
        {
            await _workService.DeleteWork(ids);
        }
    }
}
